<?php
/*
+--------------------------------------------------------------------------
|   AffiliStore 2
|   ========================================
|   Web: http://www.affilistore.com
|   Email: admin (at) affilistore (dot) com
|	License Type: AffiliStore 2 is NOT open source software and limitations apply 
|   Licence Info: Visit AffiliStore website and click on 'Licence'
+--------------------------------------------------------------------------
*/
if (eregi(".inc.php",$HTTP_SERVER_VARS['PHP_SELF']) || eregi(".inc.php",$_SERVER['PHP_SELF'])) {
	echo "<html>\r\n<head>\r\n<title>Forbidden 403</title>\r\n</head>\r\n<body><h3>Forbidden 403</h3>\r\nThe document you are requesting is forbidden.\r\n</body>\r\n</html>";
	exit;
}

$box_content = new XTemplate ("skins/".$configSkin['value']."/styleTemplates/accountlogin.tpl");
include_once 'includes/models/Auth.php';

if(isset($_POST['username'])) {
	$username = $_POST['username'];
	$password = $_POST['password'];
	
	$auth = Auth::getInstance()
			->setIdentity($username)
			->setCredential($password);
	
	$result = $auth->authenticate();
	if($result->isValid()){
		header("Location: {$installDir['value']}merchant/userpanel.php");
	}
	else
	{
		$box_content->parse('page.error');
	}
}
			
$box_content->assign("SKIN",$configSkin['value']);
$box_content->parse('page');
$box_content =  $box_content->text('page');
?>